package org.example.api;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisSet {
    public static void test1(Jedis jedis) {
        jedis.flushDB();
        jedis.sadd("key1","lisi","wangwu","zhangsan","zhaosi");
        jedis.sadd("key2","wangwu","zhangsan","zhaosi");
        System.out.println(jedis.smembers("key1"));
        System.out.println(jedis.sismember("key1","lisi"));
        System.out.println(jedis.scard("key1"));
        System.out.println(jedis.sinter("key1","key2"));
        System.out.println(jedis.sinterstore("key3","key1","key2"));
    }
    public static void main(String[] args) {
        JedisPool jedisPool = new JedisPool("tcp://127.0.0.1:8888");
        try (Jedis jedis = jedisPool.getResource()){
            test1(jedis);
        }
    }
}
